package designpatterns.abstractfactory;

/**
 * @description:
 * @author: Lidong
 * @time: 2020/7/21 21:43
 **/
public class FactoryProducer {

    /**
     * 获取工厂实例
     *
     * @param type 工厂类型
     * @return AbstractFactory
     */
    public static AbstractFactory getFactoryInstance(String type) {
        if (ShapeFactory.TYPE.equalsIgnoreCase(type)) {
            return new ShapeFactory();
        } else if (ColorFactory.TYPE.equalsIgnoreCase(type)) {
            return new ColorFactory();
        }
        return null;
    }
}
